package com.opengw.controller.processor;

import com.opengw.exception.OpenGWException;

public class ProcessorFactory {
	
	public static final String SERVICE_URI = "/service/";
	public static final String ROUTE_URI = "/route/";
	public static final String PUBLISH_URI = "/publish/";

	public BaseProcessor getProcessor(String requestURI) throws OpenGWException{
		if(requestURI.startsWith(SERVICE_URI))
			return new ServiceProcessor();
		else if(requestURI.startsWith(ROUTE_URI))
			return new RouteProcessor();
		else if(requestURI.startsWith(PUBLISH_URI))
			return new PublishProcessor();
		else
			throw new OpenGWException(OpenGWException.NOT_FOUND_RESOURCE, true);
	}
}
